Skip to content

Conversation

@lyrixx
Copy link
Member

@lyrixx lyrixx commented Nov 27, 2025

Q A
Bug fix? no
New feature? no
Docs? no
Issues
License MIT

@carsonbot carsonbot added Agent Issues & PRs about the AI Agent component Status: Needs Review labels Nov 27, 2025
}

private function handleToolCallsCallback(Output $output): \Closure
private function handleToolCallsCallback(Output $output, ToolCallResult $result, ?AssistantMessage $streamedAssistantResponse = null): ResultInterface
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reduced the indirection. This reduce the depth in the stack.


/**
* @param class-string $reference
* @param class-string $className
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use only one name for a "thing". Line 30, this is called className.
I think it's better to be consistant, it's easier to understand

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't have to be a class tho, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to understand. What could it be, if it's not a class, but the type is class-string?

* List of executable tools.
*
* @var list<mixed>
* @var list<object>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We call ::class on item. So it must be an object. See linne 69

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we extract this as a small bugfix please?

$this->tools = $tools instanceof \Traversable ? iterator_to_array($tools) : $tools;
}

public function getTools(): array
Copy link
Member Author

@lyrixx lyrixx Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is something a bit hard to understand.
getTools does not return tool, but tools metadata !

I would like to rebame Tool to ToolMetadata, getTools() to getToolsMetadata()

It will really ease on-boarding I guess.

And it will fix inconsistency. For example :

private function getMetadata(ToolCall $toolCall): Tool

@OskarStark
Copy link
Contributor

PR title: Tall or Tool?

@lyrixx lyrixx changed the title [Agent] Code groming arround tall call [Agent] Code grooming around tool call Nov 28, 2025
@lyrixx
Copy link
Member Author

lyrixx commented Nov 28, 2025

Ouch, too many typos 😅 . I edited the PR title.

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine after this small gotcha

@chr-hertel
Copy link
Member

and the PHPStan issue looks real - wonder if that's worth the trouble

@lyrixx
Copy link
Member Author

lyrixx commented Dec 2, 2025

and the PHPStan issue looks real - wonder if that's worth the trouble

There was a real issue with PHPStan. Since the code is now better, PHPStan found the typo. I fixed it.


Pr rebases, and cleaned. Ready for review

Note

there is a pending question about a bigger cleaning. It would happen in a new PR, But I would love to get an answer.

* role: 'assistant',
* content: ?string,
* tool_calls: array{
* tool_calls: list<array{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a bug fix to me, which deserves a separate PR

OskarStark added a commit that referenced this pull request Dec 3, 2025
…ltConverter` (lyrixx)

This PR was merged into the main branch.

Discussion
----------

[Platform][OpenAI] Fix `$choice` argument type in `Gpt\ResultConverter`

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Docs?         | no
| Issues        |
| License       | MIT

See #1010 (comment)

Commits
-------

4d59873 [Platform] Fix `$choice` argument type in Gpt\ResultConverter
OskarStark added a commit that referenced this pull request Dec 4, 2025
This PR was merged into the main branch.

Discussion
----------

[Agent] Fix type of `Toolbox::$tools`

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Docs?         | no
| Issues        |
| License       | MIT

see #1010 (comment)

Commits
-------

0a90585 [Agent] Fix type of Toolbox::$tools
@lyrixx lyrixx force-pushed the agent-tool-review branch from 738c641 to d6b873e Compare December 4, 2025 08:57
@chr-hertel chr-hertel added the BC Break Breaking the Backwards Compatibility Promise label Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Agent Issues & PRs about the AI Agent component BC Break Breaking the Backwards Compatibility Promise Status: Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants